<template>
  <div
    class="notice"
    :style="{
      transform: `translateY(${translateY}px)`,
    }"
  >
    {{ msg }}
  </div>
</template>
<script setup>
import { ref, defineProps, onMounted } from 'vue'
let translateY = ref(0)
defineProps({
  msg: String,
})
onMounted(() => {
  setTimeout(() => {
    translateY.value = -100
  }, 1000)
})

console.log('notice')
</script>
<style lang="scss" scoped>
.notice {
  width: 200px;
  height: 50px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.8);
  position: fixed;
  left: calc(50% - 100px);
  top: 2%;
  transition: all 0.5s;
  display: flex;
  justify-content: center;
  align-items: center;

  font-size: 18px;
  color: red;
}
</style>
